package com.ieasy.module.system.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity @Table(name="ieasy_common_intellectual")
public class Intellectual {
	
	private int id ;
	
	private String title ;
	
	private String type ;
	
	private String content ;
	
	private Date created ;
	
	private Set<RoleEntity> roles = new HashSet<RoleEntity>(0) ;					//权限角色
	
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "ieasy_common_intell_roles", joinColumns = { @JoinColumn(name = "intell_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "role_id", nullable = false, updatable = false) })
	public Set<RoleEntity> getRoles() {
		return roles;
	}

	@Id @GeneratedValue
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Lob @Column(length=16777216)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public void setRoles(Set<RoleEntity> roles) {
		this.roles = roles;
	}
}
